<template>
  <div class="container">
    <div class="userPage">
      <!--导航部分开始-->
      <ul class="navbar-nav">
        <li class="nav-title">
          Let's go !
        </li>
        <router-link to="checkInfo" class="nav-item" :class="menu === '/userPage/checkInfo'?'nav-item-selected':''">
          <li>个人信息</li>
        </router-link>
        <router-link to="editInfo" class="nav-item" :class="menu === '/userPage/editInfo'?'nav-item-selected':''">
          <li>修改资料</li>
        </router-link>
      </ul>
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      menu: this.$route.path
    }
  },
  watch: {
    '$route': function (to) {
      this.menu = to.path
    }
  }
}
</script>

<style scoped>
  .navbar-nav{
    width: 20%;
    float: left;
    margin-top: 20px;
    margin-left: 0px;
  }
  .nav-title{
    text-align: center;
    font-size: 25px;
    font-weight: bold;
  }
  .nav-item{
    line-height: 40px;
    color: cadetblue;
    font-size: 20px;
    text-align: center;
    border: 1px gainsboro solid;
    border-radius: 10px;
    box-shadow: 0px 0px 10px gainsboro;
    margin: 3px;
  }
  .nav-item:hover{
    text-decoration: none;
    font-weight: bold;
  }
  .nav-item-selected{
    color: white;
    background-color: cadetblue;
  }
</style>
